package com.qf.test;

import com.qf.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Wy
 * @version V1.0
 * @Project MavenDemo
 * @Package com.qf.test
 * @Description:
 * @Date 2022/6/2 16:42
 */
public class testbean {

    @Test
    public void name() {
        //获取Spring的工厂接口
       ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
       //获取实例化对象
        UserService userService = (UserService) context.getBean("userService");

        userService.registerUser();

        ((ClassPathXmlApplicationContext)context).close();


    }
}
